fermats theorem in cryptography and network security